Remember, the total distance is 40,000km but each plane only holds enough fuel to go 20,000km.
In our diagram, the professor is in the top green plane. The blobs on each plane show how much fuel they are carrying.
Each plane sets off full. After 5,000km, each plane is 3/4 full. The blue plane then transfers 1/4 to each of the other planes, and then the blue plane returns home to re-fuel.
When the professor has travelled 30,000km, the other planes come from the other direction.
The diagram tells the whole of the story!